# Maintainer: Thomas Dziedzic < gostrc at gmail >
# Contributor: Anton Bazhenov <anton.bazhenov at gmail>
# Contributor: Michal Bozon <michal.bozon__at__gmail.com>

pkgname=nltk-data
pkgver=2.0
pkgrel=7
pkgdesc='Corpora, grammars and other linguistic data for NLTK'
arch=('any')
url='http://nltk.sourceforge.net/'
license=('custom')
makedepends=('unzip' 'python2-nltk')
source=('LICENSE')
md5sums=('69998d5f493a60e7a1467b8003ab8e22')

package() {
  install -d ${pkgdir}/usr/share/nltk_data
  python2 -m nltk.downloader -d ${pkgdir}/usr/share/nltk_data all

  for _dir in ${pkgdir}/usr/share/nltk_data/*; do
    unzip -u ${_dir}/\*.zip -d ${_dir}
    rm -f ${_dir}/*.zip
  done

  find ${pkgdir}/usr/share/nltk_data/ -type f -exec chmod 0644 {} \;
  find ${pkgdir}/usr/share/nltk_data/ -type d -exec chmod 0755 {} \;

  install -d ${pkgdir}/usr/share/licenses/nltk-data
  install -m644 ${srcdir}/LICENSE \
    ${pkgdir}/usr/share/licenses/nltk-data
}
